<?php  
	require_once ("dbconnection.php");
  	$conn = new DBConnect();
  
  	$getTable = mysql_query("SELECT * FROM news", $conn->connect());
  	$num_rows = mysql_num_rows($getTable);
  	
  	for($i = 0; $i < $num_rows; $i++)
  	{
	  	$stitle = mysql_query("SELECT NEWS_TITLE FROM NEWS", $conn->connect()) 
	            or die ("Problem reading table: ".mysql_error());
	  	$title =  mysql_result($stitle, $i);
	  	$sauthor = mysql_query("SELECT NEWS_AUTOR FROM NEWS", $conn->connect())
	  	or die ("Problem reading table: ".mysql_error());
	  	$author =  mysql_result($sauthor, $i);
	  	$sbody = mysql_query("SELECT NEWS_BODY FROM NEWS", $conn->connect()) 
	            or die ("Problem reading table: ".mysql_error());
	  	$body = mysql_result($sbody, $i);
	  	$sdate = mysql_query("SELECT NEWS_DATE FROM NEWS", $conn->connect())
	  	or die ("Problem reading table: ".mysql_error());
	  	$date = mysql_result($sdate, $i);
	  	$simage = mysql_query("SELECT IMAGE_PATH FROM IMAGES", $conn->connect()) 
	            or die ("Problem reading table: ".mysql_error());
	  	$image = mysql_result($simage, $i);
	  	$sid = mysql_query("SELECT ID FROM NEWS", $conn->connect())
	  	or die ("Problem reading table: ".mysql_error());
	  	$id = mysql_result($sid, $i);
	  	
?>		
				<div class="news">
<?php 
		    	echo "<a href='?page=article&id=".$id."'><img src='".$image."' class='artimage' style='height: 123px;'/></a>";
		  		echo "<a href='?page=article&id=".$id."' class='arttitle'>".$title."<span></span></a>";
		  		echo "<br/><span class='hartdate'>".$date." by ".$author."</span>";
		        echo "<p class='artbody'>".substr($body,0,170)."...</p>";
?>
    			</div>
<?php 
  	}
?>    	
    		</div>
    </div>

 

    	